/*
 *  CLRadeonExtender - Unofficial OpenCL Radeon Extensions Library
 *  Copyright (C) 2014-2018 Mateusz Szpakowski
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License as published by the Free Software Foundation; either
 *  version 2.1 of the License, or (at your option) any later version.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

#include <CLRX/Config.h>
#include "GCNAsmOpc.h"

const GCNAsmOpcodeCase encGCN14OpcodeCases[] =
{
    /* GCN 1.2 flat scratch */
    { "    s_add_u32  flat_scratch_lo, s4, s61", 0x80663d04U, 0, false, true, "" },
    { "    s_add_u32  flat_scratch_hi, s4, s61", 0x80673d04U, 0, false, true, "" },
    /* extra scalar registers */
    { "s_add_u32 s21, shared_base, s61\n", 0x80153debU, 0, false, true, "" },
    { "s_add_u32 s21, src_shared_base, s61\n", 0x80153debU, 0, false, true, "" },
    { "s_add_u32 s21, shared_limit, s61\n", 0x80153decU, 0, false, true, "" },
    { "s_add_u32 s21, src_shared_limit, s61\n", 0x80153decU, 0, false, true, "" },
    { "s_add_u32 s21, private_base, s61\n", 0x80153dedU, 0, false, true, "" },
    { "s_add_u32 s21, src_private_base, s61\n", 0x80153dedU, 0, false, true, "" },
    { "s_add_u32 s21, private_limit, s61\n", 0x80153deeU, 0, false, true, "" },
    { "s_add_u32 s21, src_private_limit, s61\n", 0x80153deeU, 0, false, true, "" },
    { "s_add_u32 s21, pops_exiting_wave_id, s61\n", 0x80153defU, 0, false, true, "" },
    { "s_add_u32 s21, src_pops_exiting_wave_id, s61\n", 0x80153defU, 0, false, true, "" },
    { "s_add_u32 s21, execz, s61\n", 0x80153dfcU, 0, false, true, "" },
    { "s_add_u32 s21, src_execz, s61\n", 0x80153dfcU, 0, false, true, "" },
    { "s_add_u32 s21, vccz, s61\n", 0x80153dfbU, 0, false, true, "" },
    { "s_add_u32 s21, src_vccz, s61\n", 0x80153dfbU, 0, false, true, "" },
    { "s_add_u32 s21, scc, s61\n", 0x80153dfdU, 0, false, true, "" },
    { "s_add_u32 s21, src_scc, s61\n", 0x80153dfdU, 0, false, true, "" },
    { "s_add_u32 ttmp0, s4, s61", 0x806c3d04U, 0, false, true, "" },
    { "s_add_u32 ttmp1, s4, s61", 0x806d3d04U, 0, false, true, "" },
    { "s_add_u32 ttmp2, s4, s61", 0x806e3d04U, 0, false, true, "" },
    { "s_add_u32 ttmp3, s4, s61", 0x806f3d04U, 0, false, true, "" },
    { "s_add_u32 ttmp4, s4, s61", 0x80703d04U, 0, false, true, "" },
    { "s_add_u32 ttmp5, s4, s61", 0x80713d04U, 0, false, true, "" },
    { "s_add_u32 ttmp14, s4, s61", 0x807a3d04U, 0, false, true, "" },
    { "s_add_u32 ttmp15, s4, s61", 0x807b3d04U, 0, false, true, "" },
    { "s_add_u32 ttmp16, s4, s61", 0x807b3d04U, 0, false, false,
        "test.s:1:11: Error: TTMPRegister number out of range (0-15)\n" },
    { "s_add_u32 ttmp[5], s4, s61", 0x80713d04U, 0, false, true, "" },
    { "s_add_u32 ttmp[5:5], s4, s61", 0x80713d04U, 0, false, true, "" },
    { "    s_add_u32  tma_lo, s4, s61", 0x806e3d04U, 0, false, false,
        "test.s:1:16: Error: Expected 1 scalar register\n" },
    { "    s_add_u32  tba_lo, s4, s61", 0x806e3d04U, 0, false, false,
        "test.s:1:16: Error: Expected 1 scalar register\n" },
    /* SOP2 instructions */
    { "        s_mul_hi_u32    s21, s4, s61\n", 0x96153d04U, 0, false, true, "" },
    { "        s_mul_hi_i32    s21, s4, s61\n", 0x96953d04U, 0, false, true, "" },
    { "        s_lshl1_add_u32 s21, s4, s61\n", 0x97153d04U, 0, false, true, "" },
    { "        s_lshl2_add_u32 s21, s4, s61\n", 0x97953d04U, 0, false, true, "" },
    { "        s_lshl3_add_u32 s21, s4, s61\n", 0x98153d04U, 0, false, true, "" },
    { "        s_lshl4_add_u32 s21, s4, s61\n", 0x98953d04U, 0, false, true, "" },
    { "        s_pack_ll_b32_b16 s21, s4, s61\n", 0x99153d04U, 0, false, true, "" },
    { "        s_pack_lh_b32_b16 s21, s4, s61\n", 0x99953d04U, 0, false, true, "" },
    { "        s_pack_hh_b32_b16 s21, s4, s61\n", 0x9a153d04U, 0, false, true, "" },
    /* SOP1 instructions */
    { "s_andn1_saveexec_b64 s[86:87], s[20:21]\n", 0xbed63314U, 0, false, true, "" },
    { "s_orn1_saveexec_b64 s[86:87], s[20:21]\n", 0xbed63414U, 0, false, true, "" },
    { "s_andn1_wrexec_b64 s[86:87], s[20:21]\n", 0xbed63514U, 0, false, true, "" },
    { "s_andn2_wrexec_b64 s[86:87], s[20:21]\n", 0xbed63614U, 0, false, true, "" },
    { "s_bitreplicate_b64_b32 s[86:87], s20\n", 0xbed63714U, 0, false, true, "" },
    /* SOPK instructions */
    { "s_call_b64 s[44:45], xxxx+8\nxxxx:", 0xbaac0002U, 0, false, true, "" },
    /* SOPP instructions */
    { "        s_endpgm_ordered_ps_done\n", 0xbf9e0000U, 0, false, true, "" },
    /* hwreg names */
    { "    s_getreg_b32    s43, hwreg(mode, 0, 1)", 0xb8ab0001U, 0, false, true, "" },
    { "    s_getreg_b32    s43, hwreg  (mode, 0, 1)", 0xb8ab0001U, 0, false, true, "" },
    { "    s_getreg_b32    s43, hwreg  (mode  ,   0  , 1  )",
                    0xb8ab0001U, 0, false, true, "" },
    { "    s_getreg_b32    s43, hwreg(HWREG_MODE, 0, 1)", 0xb8ab0001U, 0, false, true, "" },
    { "    s_getreg_b32    s43, hwreg(status, 0, 1)", 0xb8ab0002U, 0, false, true, "" },
    { "    s_getreg_b32    s43, hwreg(HWREG_STATUS, 0, 1)",
        0xb8ab0002U, 0, false, true, "" },
    { "    s_getreg_b32    s43, hwreg(trapsts, 0, 1)", 0xb8ab0003U, 0, false, true, "" },
    { "    s_getreg_b32    s43, hwreg(HWREG_TRAPSTS, 0, 1)",
                    0xb8ab0003U, 0, false, true, "" },
    { "    s_getreg_b32    s43, hwreg(hw_id, 0, 1)", 0xb8ab0004U, 0, false, true, "" },
    { "    s_getreg_b32    s43, hwreg(HWREG_HW_ID, 0, 1)",
                    0xb8ab0004U, 0, false, true, "" },
    { "    s_getreg_b32    s43, hwreg(gpr_alloc, 0, 1)", 0xb8ab0005U, 0, false, true, "" },
    { "    s_getreg_b32    s43, hwreg(HWREG_GPR_ALLOC, 0, 1)",
                    0xb8ab0005U, 0, false, true, "" },
    { "    s_getreg_b32    s43, hwreg(lds_alloc, 0, 1)", 0xb8ab0006U, 0, false, true, "" },
    { "    s_getreg_b32    s43, hwreg(HWREG_LDS_ALLOC, 0, 1)",
                    0xb8ab0006U, 0, false, true, "" },
    { "    s_getreg_b32    s43, hwreg(ib_sts, 0, 1)", 0xb8ab0007U, 0, false, true, "" },
    { "    s_getreg_b32    s43, hwreg(HWREG_IB_STS, 0, 1)",
                    0xb8ab0007U, 0, false, true, "" },
    { "    s_getreg_b32    s43, hwreg(pc_lo, 0, 1)", 0xb8ab0008U, 0, false, true, "" },
    { "    s_getreg_b32    s43, hwreg(HWREG_PC_LO, 0, 1)",
                    0xb8ab0008U, 0, false, true, "" },
    { "    s_getreg_b32    s43, hwreg(pc_hi, 0, 1)", 0xb8ab0009U, 0, false, true, "" },
    { "    s_getreg_b32    s43, hwreg(HWREG_PC_HI, 0, 1)",
                    0xb8ab0009U, 0, false, true, "" },
    { "    s_getreg_b32    s43, hwreg(inst_dw0, 0, 1)", 0xb8ab000aU, 0, false, true, "" },
    { "    s_getreg_b32    s43, hwreg(HWREG_INST_DW0, 0, 1)",
                    0xb8ab000aU, 0, false, true, "" },
    { "    s_getreg_b32    s43, hwreg(inst_dw1, 0, 1)", 0xb8ab000bU, 0, false, true, "" },
    { "    s_getreg_b32    s43, hwreg(HWREG_INST_DW1, 0, 1)",
                    0xb8ab000bU, 0, false, true, "" },
    { "    s_getreg_b32    s43, hwreg(ib_dbg0, 0, 1)", 0xb8ab000cU, 0, false, true, "" },
    { "    s_getreg_b32    s43, hwreg(HWREG_IB_DBG0, 0, 1)",
                    0xb8ab000cU, 0, false, true, "" },
    { "    s_getreg_b32    s43, hwreg(ib_dbg1, 0, 1)", 0xb8ab000dU, 0, false, true, "" },
    { "    s_getreg_b32    s43, hwreg(HWREG_IB_DBG1, 0, 1)",
                0xb8ab000dU, 0, false, true, "" },
    { "    s_getreg_b32    s43, hwreg(flush_ib, 0, 1)", 0xb8ab000eU, 0, false, true, "" },
    { "    s_getreg_b32    s43, hwreg(HWREG_FLUSH_IB, 0, 1)",
                0xb8ab000eU, 0, false, true, "" },
    { "    s_getreg_b32    s43, hwreg(sh_mem_bases, 0, 1)",
                0xb8ab000fU, 0, false, true, "" },
    { "    s_getreg_b32    s43, hwreg(HWREG_SH_MEM_BASES, 0, 1)",
                0xb8ab000fU, 0, false, true, "" },
    { "    s_getreg_b32    s43, hwreg(sq_shader_tba_lo, 0, 1)",
                0xb8ab0010U, 0, false, true, "" },
    { "    s_getreg_b32    s43, hwreg(HWREG_SQ_SHADER_TBA_LO, 0, 1)",
                0xb8ab0010U, 0, false, true, "" },
    { "    s_getreg_b32    s43, hwreg(sq_shader_tba_hi, 0, 1)",
                0xb8ab0011U, 0, false, true, "" },
    { "    s_getreg_b32    s43, hwreg(HWREG_SQ_SHADER_TBA_HI, 0, 1)",
                0xb8ab0011U, 0, false, true, "" },
    { "    s_getreg_b32    s43, hwreg(sq_shader_tma_lo, 0, 1)",
                0xb8ab0012U, 0, false, true, "" },
    { "    s_getreg_b32    s43, hwreg(HWREG_SQ_SHADER_TMA_LO, 0, 1)",
                0xb8ab0012U, 0, false, true, "" },
    { "    s_getreg_b32    s43, hwreg(sq_shader_tma_hi, 0, 1)",
                0xb8ab0013U, 0, false, true, "" },
    { "    s_getreg_b32    s43, hwreg(HWREG_SQ_SHADER_TMA_HI, 0, 1)",
                0xb8ab0013U, 0, false, true, "" },
    { "    s_getreg_b32    s43, hwreg(tba_lo, 0, 1)", 0xb8ab0010U, 0, false, true, "" },
    { "    s_getreg_b32    s43, hwreg(HWREG_TBA_LO, 0, 1)",
                0xb8ab0010U, 0, false, true, "" },
    { "    s_getreg_b32    s43, hwreg(tba_hi, 0, 1)", 0xb8ab0011U, 0, false, true, "" },
    { "    s_getreg_b32    s43, hwreg(HWREG_TBA_HI, 0, 1)",
                0xb8ab0011U, 0, false, true, "" },
    { "    s_getreg_b32    s43, hwreg(tma_lo, 0, 1)", 0xb8ab0012U, 0, false, true, "" },
    { "    s_getreg_b32    s43, hwreg(HWREG_TMA_LO, 0, 1)",
                0xb8ab0012U, 0, false, true, "" },
    { "    s_getreg_b32    s43, hwreg(tma_hi, 0, 1)", 0xb8ab0013U, 0, false, true, "" },
    { "    s_getreg_b32    s43, hwreg(HWREG_TMA_HI, 0, 1)",
                0xb8ab0013U, 0, false, true, "" },
    /* message types */
    { "    s_sendmsg  sendmsg(interrupt)", 0xbf900001U, 0, false, true, "" },
    { "    s_sendmsg  sendmsg(MSG_INTERRUPT)", 0xbf900001U, 0, false, true, "" },
    { "    s_sendmsg  sendmsg(system)", 0xbf90000fU, 0, false, true, "" },
    { "    s_sendmsg  sendmsg(MSG_SYSTEM)", 0xbf90000fU, 0, false, true, "" },
    { "    s_sendmsg  sendmsg(MSG_SYSMSG)", 0xbf90000fU, 0, false, true, "" },
    { "    s_sendmsg  sendmsg(gs, nop)", 0xbf900002U, 0, false, true, "" },
    { "    s_sendmsg  sendmsg(MSG_GS, GS_OP_NOP)", 0xbf900002U, 0, false, true, "" },
    { "    s_sendmsg  sendmsg(gs, cut, 0)", 0xbf900012U, 0, false, true, "" },
    { "    s_sendmsg  sendmsg(MSG_GS, GS_OP_CUT, 0)", 0xbf900012U, 0, false, true, "" },
    { "    s_sendmsg  sendmsg(gs, cut, 1)", 0xbf900112U, 0, false, true, "" },
    { "    s_sendmsg  sendmsg(MSG_GS, GS_OP_CUT, 1)", 0xbf900112U, 0, false, true, "" },
    { "    s_sendmsg  sendmsg(gs, emit, 0)", 0xbf900022U, 0, false, true, "" },
    { "    s_sendmsg  sendmsg(MSG_GS, GS_OP_EMIT, 0)", 0xbf900022U, 0, false, true, "" },
    { "    s_sendmsg  sendmsg(gs, emit_cut, 3)", 0xbf900332U, 0,
        false, true, "" },
    { "    s_sendmsg  sendmsg(gs, emit-cut, 3)", 0xbf900332U, 0,
        false, true, "" },
    { "    s_sendmsg  sendmsg ( gs    , emit_cut  , 3  )", 0xbf900332U, 0,
        false, true, "" },
    { "    s_sendmsg  sendmsg(MSG_GS, GS_OP_EMIT_CUT, 3)", 0xbf900332U, 0,
        false, true, "" },
    { "    s_sendmsg  sendmsg(gs_done, nop)", 0xbf900003U, 0, false, true, "" },
    { "    s_sendmsg  sendmsg(MSG_GS_DONE, GS_OP_NOP)", 0xbf900003U, 0, false, true, "" },
    { "    s_sendmsghalt  sendmsg(interrupt)", 0xbf910001U, 0, false, true, "" },
    { "    s_sendmsg  sendmsg(MSG_SAVEWAVE)",
        0xbf900004U, 0, false, true, "" },
    { "    s_sendmsg  sendmsg(savewave)", 0xbf900004U, 0, false, true, "" },
    { "    s_sendmsg  sendmsg(MSG_STALL_WAVE_GEN)", 0xbf900005U, 0, false, true, "" },
    { "    s_sendmsg  sendmsg(stall_wave_gen)", 0xbf900005U, 0, false, true, "" },
    { "    s_sendmsg  sendmsg(MSG_HALT_WAVES)", 0xbf900006U, 0, false, true, "" },
    { "    s_sendmsg  sendmsg(halt_waves)", 0xbf900006U, 0, false, true, "" },
    { "    s_sendmsg  sendmsg(MSG_ORDERED_PS_DONE)", 0xbf900007U, 0, false, true, "" },
    { "    s_sendmsg  sendmsg(ordered_ps_done)", 0xbf900007U, 0, false, true, "" },
    { "    s_sendmsg  sendmsg(MSG_EARLY_PRIM_DEALLOC)", 0xbf900008U, 0, false, true, "" },
    { "    s_sendmsg  sendmsg(early_prim_dealloc)", 0xbf900008U, 0, false, true, "" },
    { "    s_sendmsg  sendmsg(MSG_GS_ALLOC_REQ)", 0xbf900009U, 0, false, true, "" },
    { "    s_sendmsg  sendmsg(gs_alloc_req)", 0xbf900009U, 0, false, true, "" },
    { "    s_sendmsg  sendmsg(MSG_GET_DOORBELL)", 0xbf90000aU, 0, false, true, "" },
    { "    s_sendmsg  sendmsg(get_doorbell)", 0xbf90000aU, 0, false, true, "" },
    /* waitcnts */
    { "s_waitcnt       vmcnt(6) & expcnt(3) & lgkmcnt(13)\n",
        0xbf8c0d36U, 0, false, true, "" },
    { "s_waitcnt       vmcnt(22) & expcnt(3) & lgkmcnt(13)\n",
        0xbf8c4d36U, 0, false, true, "" },
    { "s_waitcnt       vmcnt(38) & expcnt(3) & lgkmcnt(13)\n",
        0xbf8c8d36U, 0, false, true, "" },
    { "s_waitcnt       vmcnt(54) & expcnt(3) & lgkmcnt(13)\n",
        0xbf8ccd36U, 0, false, true, "" },
    { "s_waitcnt       vmcnt(15) & expcnt(3) & lgkmcnt(13)\n",
        0xbf8c0d3fU, 0, false, true, "" },
    { "s_waitcnt       vmcnt(31) & expcnt(3) & lgkmcnt(13)\n",
        0xbf8c4d3fU, 0, false, true, "" },
    { "s_waitcnt       vmcnt(47) & expcnt(3) & lgkmcnt(13)\n",
        0xbf8c8d3fU, 0, false, true, "" },
    { "s_waitcnt       expcnt(3) & lgkmcnt(13)\n", 0xbf8ccd3fU, 0, false, true, "" },
    { "s_waitcnt       " "vmcnt(0) & expcnt(0) & lgkmcnt(0)\n",
        0xbf8c0000U, 0, false, true, "" },
    /* SMEM encoding */
    { "s_load_dword    s50, s[58:59], s91\n", 0xc0000c9dU, 0x5b, true, true, "" },
    { "s_load_dword    s50, s[58:59], s91 glc:0 nv:0\n",
        0xc0000c9dU, 0x5b, true, true, "" },
    { "s_load_dword    s50, s[58:59], 0x5b\n", 0xc0020c9dU, 0x5b, true, true, "" },
    { "s_load_dword    s50, s[58:59], 0x13da5b\n", 0xc0020c9dU, 0x13da5b, true, true, "" },
    { "s_load_dword    s50, s[58:59], 0x5b nv\n", 0xc0028c9dU, 0x5b, true, true, "" },
    { "s_load_dword    s50, s[58:59], 0x5b nv:1\n", 0xc0028c9dU, 0x5b, true, true, "" },
    { "s_load_dword    s50, s[58:59], 0x5b nv glc\n", 0xc0038c9dU, 0x5b, true, true, "" },
    { "s_load_dword    s50, s[58:59], s25 offset:0x5b\n",
        0xc0024c9dU, 0x3200005b, true, true, "" },
    { "s_load_dword    s50, s[58:59], s25 offset:0x13da5b\n",
        0xc0024c9dU, 0x3213da5b, true, true, "" },
    { "s_load_dword    s50, s[58:59], zz\nzz=0x13da5b",
        0xc0020c9dU, 0x13da5b, true, true, "" },
    { "s_load_dword    s50, s[58:59], s25 offset:0x33da5b\n",
        0xc0024c9dU, 0x3213da5b, true, true,
        "test.s:1:43: Warning: Value 0x33da5b truncated to 0x13da5b\n" },
    { "s_load_dword    s50, s[58:59], 112 offset:0x5b\n",
        0, 0, false, false, "test.s:1:36: Error: Illegal second offset\n" },
    /* SMEM instructions */
    { "        s_atomic_swap s50, s[60:61], 0x5b\n", 0xc2020c9eU, 0x5b, true, true, "" },
    { "        s_atomic_cmpswap s[50:51], s[60:61], 0x5b\n",
        0xc2060c9eU, 0x5b, true, true, "" },
    { "        s_atomic_add s50, s[60:61], 0x5b\n", 0xc20a0c9eU, 0x5b, true, true, "" },
    { "        s_atomic_sub s50, s[60:61], 0x5b\n", 0xc20e0c9eU, 0x5b, true, true, "" },
    { "        s_atomic_smin s50, s[60:61], 0x5b\n", 0xc2120c9eU, 0x5b, true, true, "" },
    { "        s_atomic_umin s50, s[60:61], 0x5b\n", 0xc2160c9eU, 0x5b, true, true, "" },
    { "        s_atomic_smax s50, s[60:61], 0x5b\n", 0xc21a0c9eU, 0x5b, true, true, "" },
    { "        s_atomic_umax s50, s[60:61], 0x5b\n", 0xc21e0c9eU, 0x5b, true, true, "" },
    { "        s_atomic_and s50, s[60:61], 0x5b\n", 0xc2220c9eU, 0x5b, true, true, "" },
    { "        s_atomic_or s50, s[60:61], 0x5b\n", 0xc2260c9eU, 0x5b, true, true, "" },
    { "        s_atomic_xor s50, s[60:61], 0x5b\n", 0xc22a0c9eU, 0x5b, true, true, "" },
    { "        s_atomic_inc s50, s[60:61], 0x5b\n", 0xc22e0c9eU, 0x5b, true, true, "" },
    { "        s_atomic_dec s50, s[60:61], 0x5b\n", 0xc2320c9eU, 0x5b, true, true, "" },
    { "        s_atomic_swap_x2 s[50:51], s[60:61], 0x5b\n",
        0xc2820c9eU, 0x5b, true, true, "" },
    { "        s_atomic_cmpswap_x2 s[52:55], s[60:61], 0x5b\n",
        0xc2860d1eU, 0x5b, true, true, "" },
    { "        s_atomic_add_x2 s[50:51], s[60:61], 0x5b\n",
        0xc28a0c9eU, 0x5b, true, true, "" },
    { "        s_atomic_sub_x2 s[50:51], s[60:61], 0x5b\n",
        0xc28e0c9eU, 0x5b, true, true, "" },
    { "        s_atomic_smin_x2 s[50:51], s[60:61], 0x5b\n",
        0xc2920c9eU, 0x5b, true, true, "" },
    { "        s_atomic_umin_x2 s[50:51], s[60:61], 0x5b\n",
        0xc2960c9eU, 0x5b, true, true, "" },
    { "        s_atomic_smax_x2 s[50:51], s[60:61], 0x5b\n",
        0xc29a0c9eU, 0x5b, true, true, "" },
    { "        s_atomic_umax_x2 s[50:51], s[60:61], 0x5b\n",
        0xc29e0c9eU, 0x5b, true, true, "" },
    { "        s_atomic_and_x2 s[50:51], s[60:61], 0x5b\n",
        0xc2a20c9eU, 0x5b, true, true, "" },
    { "        s_atomic_or_x2 s[50:51], s[60:61], 0x5b\n",
        0xc2a60c9eU, 0x5b, true, true, "" },
    { "        s_atomic_xor_x2 s[50:51], s[60:61], 0x5b\n",
        0xc2aa0c9eU, 0x5b, true, true, "" },
    { "        s_atomic_inc_x2 s[50:51], s[60:61], 0x5b\n",
        0xc2ae0c9eU, 0x5b, true, true, "" },
    { "        s_atomic_dec_x2 s[50:51], s[60:61], 0x5b\n",
        0xc2b20c9eU, 0x5b, true, true, "" },
    /* SDWA encoding */
    { "   v_cndmask_b32   v154, v0, v107, vcc dst_sel:byte0 src0_sel:byte0 src1_sel:byte0",
        0x0134d6f9U, 0, true, true, "" },
    { "   v_cndmask_b32   v154, v0, v107, vcc "
        "mul:4 dst_sel:byte0 src0_sel:byte0 src1_sel:byte0",
        0x0134d6f9U, 0x8000, true, true, "" },
    { "v_add_f32   v154, v61, v107 dst_sel:byte0 src0_sel:byte0 src1_sel:byte0\n",
        0x0334d6f9U, 0x0000003dU, true, true, "" },
    { "v_add_f32   v154, v61, vcc_hi dst_sel:byte0 src0_sel:byte0 src1_sel:byte0\n",
        0x0334d6f9U, 0x8000003dU, true, true, "" },
    { "v_add_f32   v154, s61, v107 dst_sel:byte0 src0_sel:byte0 src1_sel:byte0\n",
        0x0334d6f9U, 0x0080003dU, true, true, "" },
    { "v_cndmask_b32   v154, sext(-abs(v65)), v107, vcc mul:2",
        0x0134d6f9U, 0x063e4641U, true, true, "" },
    { "v_add_f32   v154, sext(-abs(v65)), vcc_hi",
        0x0334d6f9U, 0x863e0641U, true, true, "" },
    { "v_add_f32   v154, sext(-abs(s65)), v107",
        0x0334d6f9U, 0x06be0641U, true, true, "" },
    // VOP3 encoding
    { "v_writelane_b32 v55, v27, v90", 0xd28a0037U, 0x0002b51bU, true, true, "" },
    /* SDWA encoding VOP1 */
    { "v_mov_b32   v154, v61 dst_sel:byte0 src0_sel:byte0\n",
        0x7f3402f9U, 0x0000003dU, true, true, "" },
    { "v_mov_b32   v154, v61 dst_sel:byte0 src0_sel:byte0 div:2\n",
        0x7f3402f9U, 0x0000c03dU, true, true, "" },
    { "v_mov_b32   v154, s61 dst_sel:byte0 src0_sel:byte0\n",
        0x7f3402f9U, 0x0080003dU, true, true, "" },
    { "v_mov_b32   v154, sext(s61) dst_sel:byte0 src0_sel:byte0\n",
        0x7f3402f9U, 0x0088003dU, true, true, "" },
    { "v_mov_b32   v154, sext(s61) dst_sel:byte0 src0_sel:byte0 clamp\n",
        0x7f3402f9U, 0x0088203dU, true, true, "" },
    /* SDWA encoding VOPC */
    { "v_cmp_class_f32 vcc, v0, v107 src0_sel:byte0 src1_sel:byte0",
        0x7c20d6f9U, 0x0000, true, true, "" },
    { "v_cmp_class_f32 vcc, v61, v107 src0_sel:byte0 src1_sel:byte0",
        0x7c20d6f9U, 0x3dU, true, true, "" },
    { "v_cmp_class_f32 vcc, v61, vcc_hi src0_sel:byte0 src1_sel:byte0",
        0x7c20d6f9U, 0x8000003dU, true, true, "" },
    { "v_cmp_class_f32 vcc, s61, v107 src0_sel:byte0 src1_sel:byte0\n",
        0x7c20d6f9U, 0x0080003dU, true, true, "" },
    { "v_cmp_class_f32 vcc, sext(-abs(v65)), v107",
        0x7c20d6f9U, 0x063e0041U, true, true, "" },
    { "v_cmp_class_f32 vcc, sext(-abs(v65)), vcc_hi",
        0x7c20d6f9U, 0x863e0041U, true, true, "" },
    { "v_cmp_class_f32 vcc, sext(-abs(s65)), v107",
        0x7c20d6f9U, 0x06be0041U, true, true, "" },
    { "v_cmp_class_f32 s[38:39], v0, v107 src0_sel:byte0 src1_sel:byte0",
        0x7c20d6f9U, 0xa600, true, true, "" },
    // ERRORS
    { "v_cmp_class_f32 vcc, v0, v107 mul:4 dst_sel:byte0 src0_sel:byte0 src1_sel:byte0",
        0, 0, false, false, "test.s:1:37: Error: Unknown VOP modifier\n"
        "test.s:1:44: Error: Some garbages at VOP modifier place\n" },
    { "v_cmp_class_f32 vcc, v0, v107 mul:4 dst_un:preserve src0_sel:byte0 src1_sel:byte0",
        0, 0, false, false, "test.s:1:37: Error: Unknown VOP modifier\n"
        "test.s:1:43: Error: Some garbages at VOP modifier place\n" },
    { "v_cmp_class_f32 vcc, sext(-abs(v65)), v107 mul:2",
        0, 0, false, false,
        "test.s:1:1: Error: Modifiers CLAMP and OMOD is illegal in SDWAB\n" },
    { "v_cmp_class_f32 vcc, sext(-abs(v65)), v107 clamp",
        0, 0, false, false,
        "test.s:1:1: Error: Modifiers CLAMP and OMOD is illegal in SDWAB\n" },
    // SDWA illegal
    { "    v_mac_f32  v55, v27, v90 dst_sel:b0 src0_sel:b1", 0, 0, false, false,
        "test.s:1:5: Error: SDWA encoding is illegal for this instruction\n" },
    { "    v_mac_f16  v55, v27, v90 dst_sel:b0 src0_sel:b1", 0, 0, false, false,
        "test.s:1:5: Error: SDWA encoding is illegal for this instruction\n" },
    /* VOP2 instructions */
    { "v_add_co_u32    v154, vcc, v21, v107\n", 0x3334d715U, 0, false, true, "" },
    { "v_sub_co_u32    v154, vcc, v21, v107\n", 0x3534d715U, 0, false, true, "" },
    { "v_subrev_co_u32 v154, vcc, v21, v107\n", 0x3734d715U, 0, false, true, "" },
    { "v_addc_co_u32   v154, vcc, v21, v107, vcc\n", 0x3934d715U, 0, false, true, "" },
    { "v_subb_co_u32   v154, vcc, v21, v107, vcc\n", 0x3b34d715U, 0, false, true, "" },
    { "v_subbrev_co_u32 v154, vcc, v21, v107, vcc\n", 0x3d34d715U, 0, false, true, "" },
    { "v_add_co_u32    v55, s[18:19], s27, v90\n",
        0xd1191237U, 0x0002b41bU, true, true, "" },
    { "v_add_co_u32    v55, vcc, s27, v90 vop3\n",
        0xd1196a37U, 0x0002b41bU, true, true, "" },
    { "v_sub_co_u32    v55, s[18:19], s27, v90\n",
        0xd11a1237U, 0x0002b41bU, true, true, "" },
    { "v_sub_co_u32    v55, vcc, s27, v90 vop3\n",
        0xd11a6a37U, 0x0002b41bU, true, true, "" },
    { "v_subrev_co_u32 v55, s[18:19], s27, v90\n",
        0xd11b1237U, 0x0002b41bU, true, true, "" },
    { "v_subrev_co_u32 v55, vcc, s27, v90 vop3\n",
        0xd11b6a37U, 0x0002b41bU, true, true, "" },
    { "v_addc_co_u32   v55, s[6:7], v27, -v90, s[24:25]\n",
        0xd11c0637U, 0x4062b51bU, true, true, "" },
    { "v_subb_co_u32   v55, s[6:7], v27, -v90, s[24:25]\n",
        0xd11d0637U, 0x4062b51bU, true, true, "" },
    { "v_subbrev_co_u32   v55, s[6:7], v27, -v90, s[24:25]\n",
        0xd11e0637U, 0x4062b51bU, true, true, "" },
    { "v_add_u32       v154, v21, v107\n", 0x6934d715U, 0, false, true, "" },
    { "v_sub_u32       v154, v21, v107\n", 0x6b34d715U, 0, false, true, "" },
    { "v_subrev_u32    v154, v21, v107\n", 0x6d34d715U, 0, false, true, "" },
    { "v_add_u32       v55, s27, v90 vop3\n", 0xd1340037U, 0x0002b41bU, true, true, "" },
    { "v_sub_u32       v55, s27, v90 vop3\n", 0xd1350037U, 0x0002b41bU, true, true, "" },
    { "v_subrev_u32    v55, s27, v90 vop3\n", 0xd1360037U, 0x0002b41bU, true, true, "" },
    
    { "        v_add_f32       v55, s27, v90 op_sel:[1,0,1]\n",
        0xd1014837U, 0x0002b41bU, true, true, "" },
    { "        v_add_f32       v55, s27, v90 op_sel:[1,1,0]\n",
        0xd1011837U, 0x0002b41bU, true, true, "" },
    /* VOP1 instructions */
    { "v_mov_prsv_b32  v158, v79\n", 0x7f3c6d4fU, 0, false, true, "" },
    { "v_screen_partition_4se_b32 v158, v79\n", 0x7f3c6f4fU, 0, false, true, "" },
    { "v_mov_prsv_b32  v55, v27 vop3\n", 0xd1760037U, 0x0000011bU, true, true, "" },
    { "v_screen_partition_4se_b32 v55, v27 vop3\n",
        0xd1770037U, 0x0000011bU, true, true, "" },
    { "v_cvt_norm_i16_f16 v158, v79\n", 0x7f3c9b4fU, 0, false, true, "" },
    { "v_cvt_norm_u16_f16 v158, v79\n", 0x7f3c9d4fU, 0, false, true, "" },
    { "v_sat_pk_u8_i16 v158, v79\n", 0x7f3c9f4fU, 0, false, true, "" },
    { "v_writelane_regwr_b32 v158, v79\n", 0x7f3ca14fU, 0, false, true, "" },
    { "v_swap_b32      v158, v79\n", 0x7f3ca34fU, 0, false, true, "" },
    { "v_cvt_norm_i16_f16 v55, v27 vop3\n", 0xd18d0037U, 0x0000011bU, true, true, "" },
    { "v_cvt_norm_u16_f16 v55, v27 vop3\n", 0xd18e0037U, 0x0000011bU, true, true, "" },
    { "v_sat_pk_u8_i16 v55, v27 vop3\n", 0xd18f0037U, 0x0000011bU, true, true, "" },
    { "v_writelane_regwr_b32 v55, v27 vop3\n", 0xd1900037U, 0x0000011bU, true, true, "" },
    { "v_swap_b32      v55, v27 vop3\n", 0xd1910037U, 0x0000011bU, true, true, "" },
    /* opsel */
    { "        v_cvt_f16_f32   v55, v27 op_sel:[1,0]\n",
        0xd14a0837U, 0x0000011bU, true, true, "" },
    { "        v_cvt_f16_f32   v55, v27 op_sel:[0,1]\n",
        0xd14a4037U, 0x0000011bU, true, true, "" },
    { "v_add_co_u32    v154, vcc, v21, v107 op_sel:[1,1,1]\n", 0, 0, false, false,
        "test.s:1:38: Error: Unknown VOP modifier\n"
        "test.s:1:44: Error: Some garbages at VOP modifier place\n" },
    /* VOPC opsel */
    { "        v_cmp_gt_u32    s[42:43], v50, v107 op_sel:[1,1,0]\n",
        0xd0cc182aU, 0x0002d732U, true, true, "" },
    { "        v_cmp_gt_u32    s[42:43], v50, v107 op_sel:[0,0,1]\n",
        0xd0cc402aU, 0x0002d732U, true, true, "" },
    /* VOP3 instructions */
    { "v_mad_u32_u16   v55, v79, v166, v229\n", 0xd1f10037U, 0x07974d4fU, true, true, "" },
    { "v_mad_i32_i16   v55, v79, v166, v229\n", 0xd1f20037U, 0x07974d4fU, true, true, "" },
    { "v_xad_u32       v55, v79, v166, v229\n", 0xd1f30037U, 0x07974d4fU, true, true, "" },
    { "v_min3_f16      v55, v79, v166, v229\n", 0xd1f40037U, 0x07974d4fU, true, true, "" },
    { "v_min3_i16      v55, v79, v166, v229\n", 0xd1f50037U, 0x07974d4fU, true, true, "" },
    { "v_min3_u16      v55, v79, v166, v229\n", 0xd1f60037U, 0x07974d4fU, true, true, "" },
    { "v_max3_f16      v55, v79, v166, v229\n", 0xd1f70037U, 0x07974d4fU, true, true, "" },
    { "v_max3_i16      v55, v79, v166, v229\n", 0xd1f80037U, 0x07974d4fU, true, true, "" },
    { "v_max3_u16      v55, v79, v166, v229\n", 0xd1f90037U, 0x07974d4fU, true, true, "" },
    { "v_med3_f16      v55, v79, v166, v229\n", 0xd1fa0037U, 0x07974d4fU, true, true, "" },
    { "v_med3_i16      v55, v79, v166, v229\n", 0xd1fb0037U, 0x07974d4fU, true, true, "" },
    { "v_med3_u16      v55, v79, v166, v229\n", 0xd1fc0037U, 0x07974d4fU, true, true, "" },
    { "v_lshl_add_u32  v55, v79, v166, v229\n", 0xd1fd0037U, 0x07974d4fU, true, true, "" },
    { "v_add_lshl_u32  v55, v79, v166, v229\n", 0xd1fe0037U, 0x07974d4fU, true, true, "" },
    { "v_add3_u32      v55, v79, v166, v229\n", 0xd1ff0037U, 0x07974d4fU, true, true, "" },
    { "v_lshl_or_b32   v55, v79, v166, v229\n", 0xd2000037U, 0x07974d4fU, true, true, "" },
    { "v_and_or_b32    v55, v79, v166, v229\n", 0xd2010037U, 0x07974d4fU, true, true, "" },
    { "v_or3_b32       v55, v79, v166, v229\n", 0xd2020037U, 0x07974d4fU, true, true, "" },
    { "v_mad_f16       v55, v79, v166, v229\n", 0xd2030037U, 0x07974d4fU, true, true, "" },
    { "v_mad_u16       v55, v79, v166, v229\n", 0xd2040037U, 0x07974d4fU, true, true, "" },
    { "v_mad_i16       v55, v79, v166, v229\n", 0xd2050037U, 0x07974d4fU, true, true, "" },
    { "v_fma_f16       v55, v79, v166, v229\n", 0xd2060037U, 0x07974d4fU, true, true, "" },
    { "v_div_fixup_f16 v55, v79, v166, v229\n", 0xd2070037U, 0x07974d4fU, true, true, "" },
    { "v_mad_legacy_f16 v55, v79, v166, v229\n", 0xd1ea0037U, 0x07974d4fU, true, true, "" },
    { "v_mad_legacy_u16 v55, v79, v166, v229\n", 0xd1eb0037U, 0x07974d4fU, true, true, "" },
    { "v_mad_legacy_i16 v55, v79, v166, v229\n", 0xd1ec0037U, 0x07974d4fU, true, true, "" },
    { "v_fma_legacy_f16 v55, v79, v166, v229\n", 0xd1ee0037U, 0x07974d4fU, true, true, "" },
    { "v_div_fixup_legacy_f16 v55, v79, v166, v229\n",
        0xd1ef0037U, 0x07974d4fU, true, true, "" },
    { "v_interp_p2_legacy_f16 v42, v1, attr39.z, s29\n",
        0xd276002aU, 0x007602a7U, true, true, "" },
    { "v_interp_p2_f16 v42, v1, attr39.z, s29\n",
        0xd277002aU, 0x007602a7U, true, true, "" },
    { "v_cvt_pknorm_i16_f16 v55, v27, v90\n", 0xd2990037U, 0x0002b51bU, true, true, "" },
    { "v_cvt_pknorm_u16_f16 v55, v27, v90\n", 0xd29a0037U, 0x0002b51bU, true, true, "" },
    { "v_readlane_regrd_b32 s55, v27, v90\n", 0xd29b0037U, 0x0002b51bU, true, true, "" },
    { "v_add_i32       v55, v27, v90\n", 0xd29c0037U, 0x0002b51bU, true, true, "" },
    { "v_sub_i32       v55, v27, v90\n", 0xd29d0037U, 0x0002b51bU, true, true, "" },
    { "v_add_i16       v55, v27, v90\n", 0xd29e0037U, 0x0002b51bU, true, true, "" },
    { "v_sub_i16       v55, v27, v90\n", 0xd29f0037U, 0x0002b51bU, true, true, "" },
    { "v_pack_b32_f16  v55, v27, v90\n", 0xd2a00037U, 0x0002b51bU, true, true, "" },
    /* VOP3 op_sel */
    { "v_interp_p2_legacy_f16 v42, v1, attr39.z, s29 op_sel:[1,1,1,1]\n",
        0xd276782aU, 0x007602a7, true, true, "" },
    { "v_interp_p2_legacy_f16 v42, v1, attr39.z, s29 op_sel:15\n",
        0xd276782aU, 0x007602a7, true, true, "" },
    { "v_interp_p2_legacy_f16 v42, v1, attr39.z, s29 op_sel:[0,1,1,1]\n",
        0xd276702aU, 0x007602a7, true, true, "" },
    { "v_interp_p2_legacy_f16 v42, v1, attr39.z, s29 op_sel:14\n",
        0xd276702aU, 0x007602a7, true, true, "" },
    { "v_interp_p2_legacy_f16 v42, v1, attr39.z, s29 op_sel:[1,0,0,1]\n",
        0xd276482aU, 0x007602a7, true, true, "" },
    { "v_interp_p2_legacy_f16 v42, v1, attr39.z, s29 op_sel:9\n",
        0xd276482aU, 0x007602a7, true, true, "" },
    { "v_alignbit_b32  v55, v79, v166, v229 op_sel:[1,1,0,1]\n",
        0xd1ce5837U, 0x07974d4fU, true, true, "" },
    { "v_alignbit_b32  v55, v79, v166, v229 op_sel:0xb\n",
        0xd1ce5837U, 0x07974d4fU, true, true, "" },
    { "v_alignbit_b32  v55, v79, v166, v229 op_sel:[0,1,1,0]\n",
        0xd1ce3037U, 0x07974d4fU, true, true, "" },
    { "v_alignbit_b32  v55, v79, v166, v229 op_sel:0x6\n",
        0xd1ce3037U, 0x07974d4fU, true, true, "" },
    /* VOP3 op_sel instructions */
    { "v_alignbit_b32  v55, v79, v166, v229 op_sel:[1,1,0,1]\n",
        0xd1ce5837U, 0x07974d4fU, true, true, "" },
    { "v_alignbyte_b32 v55, v79, v166, v229 op_sel:[1,1,0,1]\n",
        0xd1cf5837U, 0x07974d4fU, true, true, "" },
    { "v_mad_legacy_f16 v55, v79, v166, v229 op_sel:[1,1,0,1]\n",
        0xd1ea5837U, 0x07974d4fU, true, true, "" },
    { "v_mad_legacy_u16 v55, v79, v166, v229 op_sel:[1,1,0,1]\n",
        0xd1eb5837U, 0x07974d4fU, true, true, "" },
    { "v_mad_legacy_i16 v55, v79, v166, v229 op_sel:[1,1,0,1]\n",
        0xd1ec5837U, 0x07974d4fU, true, true, "" },
    { "v_fma_legacy_f16 v55, v79, v166, v229 op_sel:[1,1,0,1]\n",
        0xd1ee5837U, 0x07974d4fU, true, true, "" },
    { "v_div_fixup_legacy_f16 v55, v79, v166, v229 op_sel:[1,1,0,1]\n",
        0xd1ef5837U, 0x07974d4fU, true, true, "" },
    { "v_min3_f16      v55, v79, v166, v229 op_sel:[1,1,0,1]\n",
        0xd1f45837U, 0x07974d4fU, true, true, "" },
    { "v_min3_i16      v55, v79, v166, v229 op_sel:[1,1,0,1]\n",
        0xd1f55837U, 0x07974d4fU, true, true, "" },
    { "v_min3_u16      v55, v79, v166, v229 op_sel:[1,1,0,1]\n",
        0xd1f65837U, 0x07974d4fU, true, true, "" },
    { "v_max3_f16      v55, v79, v166, v229 op_sel:[1,1,0,1]\n",
        0xd1f75837U, 0x07974d4fU, true, true, "" },
    { "v_max3_i16      v55, v79, v166, v229 op_sel:[1,1,0,1]\n",
        0xd1f85837U, 0x07974d4fU, true, true, "" },
    { "v_max3_u16      v55, v79, v166, v229 op_sel:[1,1,0,1]\n",
        0xd1f95837U, 0x07974d4fU, true, true, "" },
    { "v_med3_f16      v55, v79, v166, v229 op_sel:[1,1,0,1]\n",
        0xd1fa5837U, 0x07974d4fU, true, true, "" },
    { "v_med3_i16      v55, v79, v166, v229 op_sel:[1,1,0,1]\n",
        0xd1fb5837U, 0x07974d4fU, true, true, "" },
    { "v_med3_u16      v55, v79, v166, v229 op_sel:[1,1,0,1]\n",
        0xd1fc5837U, 0x07974d4fU, true, true, "" },
    { "v_cvt_pknorm_i16_f16 v55, v27, v90 op_sel:[1,1,0]\n",
        0xd2991837U, 0x0002b51bU, true, true, "" },
    { "v_cvt_pknorm_i16_f16 v55, v27, v90 op_sel:[1,1,1]\n",
        0xd2995837U, 0x0002b51bU, true, true, "" },
    { "v_cvt_pknorm_u16_f16 v55, v27, v90 op_sel:[1,1,0]\n",
        0xd29a1837U, 0x0002b51bU, true, true, "" },
    { "v_cvt_pknorm_u16_f16 v55, v27, v90 op_sel:[1,1,1]\n",
        0xd29a5837U, 0x0002b51bU, true, true, "" },
    { "v_cvt_pknorm_u16_f16 v55, v27, v90 op_sel:7\n",
        0xd29a5837U, 0x0002b51bU, true, true, "" },
    { "v_add_i16       v55, v27, v90 op_sel:[1,1,0]\n",
        0xd29e1837U, 0x0002b51bU, true, true, "" },
    { "v_sub_i16       v55, v27, v90 op_sel:[1,1,0]\n",
        0xd29f1837U, 0x0002b51bU, true, true, "" },
    { "v_pack_b32_f16  v55, v27, v90 op_sel:[1,1,0]\n",
        0xd2a01837U, 0x0002b51bU, true, true, "" },
    /* VOP3P encoding */
    { "v_pk_mad_i16    v55, v79, v166, v229 op_sel_hi:[0,0,0]\n",
        0xd3800037U, 0x07974d4fU, true, true, "" },
    { "v_pk_mad_i16    v55, v79, v166, v229\n",
        0xd3804037U, 0x1f974d4fU, true, true, "" },
    { "v_pk_mad_i16    v55, v79, v166, v229 op_sel_hi:[1,0,0]\n",
        0xd3800037U, 0x0f974d4fU, true, true, "" },
    { "v_pk_mad_i16    v55, v79, v166, v229 op_sel_hi:[0,1,0]\n",
        0xd3800037U, 0x17974d4fU, true, true, "" },
    { "v_pk_mad_i16    v55, v79, v166, v229 op_sel_hi:[0,1,1]\n",
        0xd3804037U, 0x17974d4fU, true, true, "" },
    { "v_pk_mad_i16    v55, v79, v166, v229 op_sel_hi:6\n",
        0xd3804037U, 0x17974d4fU, true, true, "" },
    { "v_pk_add_i16    v55, v79, v166 op_sel_hi:[0,1]\n",
        0xd3820037U, 0x10034d4fU, true, true, "" },
    { "v_pk_mad_i16    v55, v79, v166, v229 op_sel:[1,0,0] op_sel_hi:[0,0,0]\n",
        0xd3800837U, 0x07974d4fU, true, true, "" },
    { "v_pk_mad_i16    v55, v79, v166, v229 op_sel:[1,0,0] op_sel_hi:[1,0,1]\n",
        0xd3804837U, 0x0f974d4fU, true, true, "" },
    { "v_pk_mad_i16    v55, v79, v166, v229 op_sel:[1,0,0]\n",
        0xd3804837U, 0x1f974d4fU, true, true, "" },
    { "v_pk_mad_i16    v55, v79, v166, v229 op_sel:[0,1,0] op_sel_hi:[0,0,0]\n",
        0xd3801037U, 0x07974d4fU, true, true, "" },
    { "v_pk_mad_i16    v55, v79, v166, v229 op_sel:[0,0,1] op_sel_hi:[0,0,0]\n",
        0xd3802037U, 0x07974d4fU, true, true, "" },
    { "v_pk_mad_i16    v55, v79, v166, v229 op_sel:4 op_sel_hi:[0,0,0]\n",
        0xd3802037U, 0x07974d4fU, true, true, "" },
    { "v_pk_add_i16    v55, v79, v166 op_sel:[1,1] op_sel_hi:[0,1]\n",
        0xd3821837U, 0x10034d4fU, true, true, "" },
    { "v_pk_mad_i16    v55, v79, v166, v229 neg_hi:[1,0,0]\n",
        0xd3804137U, 0x1f974d4fU, true, true, "" },
    { "v_pk_mad_i16    v55, v79, v166, v229 neg_hi:[0,1,0]\n",
        0xd3804237U, 0x1f974d4fU, true, true, "" },
    { "v_pk_mad_i16    v55, v79, v166, v229 neg_hi:[1,1,0]\n",
        0xd3804337U, 0x1f974d4fU, true, true, "" },
    { "v_pk_mad_i16    v55, v79, v166, v229 neg_hi:[0,0,1]\n",
        0xd3804437U, 0x1f974d4fU, true, true, "" },
    { "v_pk_mad_i16    v55, v79, v166, v229 neg_hi:[1,0,1]\n",
        0xd3804537U, 0x1f974d4fU, true, true, "" },
    { "v_pk_mad_i16    v55, v79, v166, v229 neg_hi:5\n",
        0xd3804537U, 0x1f974d4fU, true, true, "" },
    { "v_pk_mad_i16    v55, v79, v166, v229 neg_hi:[0,1,1]\n",
        0xd3804637U, 0x1f974d4fU, true, true, "" },
    { "v_pk_mad_i16    v55, v79, v166, v229 neg_hi:[1,1,1]\n",
        0xd3804737U, 0x1f974d4fU, true, true, "" },
    { "v_pk_add_i16    v55, v79, v166 neg_hi:[1,1]\n",
        0xd3824337U, 0x18034d4fU, true, true, "" },
    { "v_pk_mad_i16    v55, v79, v166, v229 neg_lo:[1,0,0]\n",
        0xd3804037U, 0x3f974d4fU, true, true, "" },
    { "v_pk_mad_i16    v55, v79, v166, v229 neg_lo:[0,1,0]\n",
        0xd3804037U, 0x5f974d4fU, true, true, "" },
    { "v_pk_mad_i16    v55, v79, v166, v229 neg_lo:[1,1,0]\n",
        0xd3804037U, 0x7f974d4fU, true, true, "" },
    { "v_pk_mad_i16    v55, v79, v166, v229 neg_lo:3\n",
        0xd3804037U, 0x7f974d4fU, true, true, "" },
    { "v_pk_mad_i16    v55, -v79, -v166, v229\n",
        0xd3804037U, 0x7f974d4fU, true, true, "" },
    { "v_pk_mad_i16    v55, v79, v166, v229 neg_lo:[0,0,1]\n",
        0xd3804037U, 0x9f974d4fU, true, true, "" },
    { "v_pk_mad_i16    v55, v79, v166, v229 neg_lo:[1,0,1]\n",
        0xd3804037U, 0xbf974d4fU, true, true, "" },
    { "v_pk_mad_i16    v55, v79, v166, v229 neg_lo:[0,1,1]\n",
        0xd3804037U, 0xdf974d4fU, true, true, "" },
    { "v_pk_mad_i16    v55, v79, v166, v229 neg_lo:[1,1,1]\n",
        0xd3804037U, 0xff974d4fU, true, true, "" },
    { "v_pk_add_i16    v55, v79, v166 neg_lo:[1,1]\n",
        0xd3824037U, 0x78034d4fU, true, true, "" },
    { "v_pk_mad_i16    v55, v79, v166, v229 neg_lo:[1,1,0] neg_hi:[1,0,1]\n",
        0xd3804537U, 0x7f974d4fU, true, true, "" },
    { "v_pk_mad_i16    v55, -v79, -v166, v229 clamp\n",
        0xd380c037U, 0x7f974d4fU, true, true, "" },
    /* VOP3P errors */
    { "v_pk_mad_i16    v55, -v79, -v166, v229 clamp mul:2\n", 0, 0, true, false,
        "test.s:1:46: Error: Unknown VOP modifier\n"
        "test.s:1:49: Error: Some garbages at VOP modifier place\n" },
    { "v_pk_mad_i16    v55, -v79, -v166, v229 clamp sext:2\n", 0, 0, true, false,
        "test.s:1:46: Error: Unknown VOP modifier\n"
        "test.s:1:50: Error: Some garbages at VOP modifier place\n" },
    { "v_pk_mad_i16    v55, -v79, -v166, v229 clamp abs:2\n", 0, 0, true, false,
        "test.s:1:46: Error: Unknown VOP modifier\n"
        "test.s:1:49: Error: Some garbages at VOP modifier place\n" },
    { "v_pk_mad_i16    v55, -v79, -abs(v166), v229 clamp\n", 0, 0, true, false,
        "test.s:1:32: Error: Expected operator\n"
        "test.s:1:33: Error: Expected ',' before argument\n" },
    { "v_pk_mad_i16    v55, -v79, sext(v166), v229 clamp\n", 0, 0, true, false,
        "test.s:1:32: Error: Expected operator\n"
        "test.s:1:33: Error: Expected ',' before argument\n" },
    /* VOP3P instructions */
    { "v_pk_mul_lo_u16 v55, v79, v166\n", 0xd3814037U, 0x18034d4fU, true, true, "" },
    { "v_pk_add_i16    v55, v79, v166\n", 0xd3824037U, 0x18034d4fU, true, true, "" },
    { "v_pk_sub_i16    v55, v79, v166\n", 0xd3834037U, 0x18034d4fU, true, true, "" },
    { "v_pk_lshlrev_b16 v55, v79, v166\n", 0xd3844037U, 0x18034d4fU, true, true, "" },
    { "v_pk_lshrrev_b16 v55, v79, v166\n", 0xd3854037U, 0x18034d4fU, true, true, "" },
    { "v_pk_ashrrev_i16 v55, v79, v166\n", 0xd3864037U, 0x18034d4fU, true, true, "" },
    { "v_pk_max_i16    v55, v79, v166\n", 0xd3874037U, 0x18034d4fU, true, true, "" },
    { "v_pk_min_i16    v55, v79, v166\n", 0xd3884037U, 0x18034d4fU, true, true, "" },
    { "v_pk_mad_u16    v55, v79, v166, v229\n", 0xd3894037U, 0x1f974d4fU, true, true, "" },
    { "v_pk_add_u16    v55, v79, v166\n", 0xd38a4037U, 0x18034d4fU, true, true, "" },
    { "v_pk_sub_u16    v55, v79, v166\n", 0xd38b4037U, 0x18034d4fU, true, true, "" },
    { "v_pk_max_u16    v55, v79, v166\n", 0xd38c4037U, 0x18034d4fU, true, true, "" },
    { "v_pk_min_u16    v55, v79, v166\n", 0xd38d4037U, 0x18034d4fU, true, true, "" },
    { "v_pk_fma_f16    v55, v79, v166, v229\n", 0xd38e4037U, 0x1f974d4fU, true, true, "" },
    { "v_pk_add_f16    v55, v79, v166\n", 0xd38f4037U, 0x18034d4fU, true, true, "" },
    { "v_pk_mul_f16    v55, v79, v166\n", 0xd3904037U, 0x18034d4fU, true, true, "" },
    { "v_pk_min_f16    v55, v79, v166\n", 0xd3914037U, 0x18034d4fU, true, true, "" },
    { "v_pk_max_f16    v55, v79, v166\n", 0xd3924037U, 0x18034d4fU, true, true, "" },
    { "v_mad_mix_f32   v55, v79, v166, v229\n", 0xd3a04037U, 0x1f974d4fU, true, true, "" },
    { "v_mad_mixlo_f16 v55, v79, v166, v229\n", 0xd3a14037U, 0x1f974d4fU, true, true, "" },
    { "v_mad_mixhi_f16 v55, v79, v166, v229\n", 0xd3a24037U, 0x1f974d4fU, true, true, "" },
    /* VINTRP */
    { "   v_interp_p1_f32 v93, v211, attr26.w", 0xd5746bd3U, 0, false, true, "" },
    { "   v_interp_p1_f32 v93, v211, attr26 . w", 0xd5746bd3U, 0, false, true, "" },
    { "   v_interp_p1_f32 v93, v211, aTTR26 . W", 0xd5746bd3U, 0, false, true, "" },
    { "   v_interp_p1_f32 v93, v211, aTTR00026 . W", 0xd5746bd3U, 0, false, true, "" },
    { "   v_interp_p1_f32 v93, v211, attr26.x", 0xd57468d3U, 0, false, true, "" },
    { "   v_interp_p1_f32 v93, v211, attr26.y", 0xd57469d3U, 0, false, true, "" },
    { "   v_interp_p1_f32 v93, v211, attr26.z", 0xd5746ad3U, 0, false, true, "" },
    { "   v_interp_p1_f32 v93, v211, attr63.z", 0xd574fed3U, 0, false, true, "" },
    { "   v_interp_p1_f32 v93  , v211  , attr63.z", 0xd574fed3U, 0, false, true, "" },
    { "   v_interp_p2_f32 v93, v211, attr26.w", 0xd5756bd3U, 0, false, true, "" },
    { "   v_interp_mov_f32 v93, p10, attr26.w", 0xd5766b00U, 0, false, true, "" },
    { "   v_interp_mov_f32 v93, p20, attr26.w", 0xd5766b01U, 0, false, true, "" },
    { "   v_interp_mov_f32 v93, p0, attr26.w", 0xd5766b02U, 0, false, true, "" },
    /* DS instructions */
    { "ds_write_addtid_b32 v71 offset:52583\n", 0xd83acd67U, 0x00004700U, true, true, "" },
    { "ds_write_b8_d16_hi v71, v169 offset:52583\n",
        0xd8a8cd67U, 0x0000a947U, true, true, "" },
    { "ds_write_b16_d16_hi v71, v169 offset:52583\n",
        0xd8aacd67U, 0x0000a947U, true, true, "" },
    { "ds_read_u8_d16  v139, v71 offset:52583\n",
        0xd8accd67U, 0x8b000047U, true, true, "" },
    { "ds_read_u8_d16_hi v139, v71 offset:52583\n",
        0xd8aecd67U, 0x8b000047U, true, true, "" },
    { "ds_read_i8_d16  v139, v71 offset:52583\n",
        0xd8b0cd67U, 0x8b000047U, true, true, "" },
    { "ds_read_i8_d16_hi v139, v71 offset:52583\n",
        0xd8b2cd67U, 0x8b000047U, true, true, "" },
    { "ds_read_u16_d16 v139, v71 offset:52583\n",
        0xd8b4cd67U, 0x8b000047U, true, true, "" },
    { "ds_read_u16_d16_hi v139, v71 offset:52583\n",
        0xd8b6cd67U, 0x8b000047U, true, true, "" },
    { "ds_read_addtid_b32 v139 offset:52583\n", 0xd96ccd67U, 0x8b000000U, true, true, "" },
    /* MUBUF instructions */
    { "buffer_store_byte_d16_hi v61, v[18:19], s[80:83], s35 offen idxen "
        "offset:603 glc slc lds\n", 0xe067725bU, 0x23143d12U, true, true, "" },
    { "buffer_store_short_d16_hi v61, v[18:19], s[80:83], s35 offen idxen "
        "offset:603 glc slc lds\n", 0xe06f725bU, 0x23143d12U, true, true, "" },
    { "buffer_load_ubyte_d16 v61, v[18:19], s[80:83], s35 offen idxen "
        "offset:603 glc slc lds\n", 0xe083725bU, 0x23143d12U, true, true, "" },
    { "buffer_load_ubyte_d16_hi v61, v[18:19], s[80:83], s35 offen idxen "
        "offset:603 glc slc lds\n", 0xe087725bU, 0x23143d12U, true, true, "" },
    { "buffer_load_sbyte_d16 v61, v[18:19], s[80:83], s35 offen idxen "
        "offset:603 glc slc lds\n", 0xe08b725bU, 0x23143d12U, true, true, "" },
    { "buffer_load_sbyte_d16_hi v61, v[18:19], s[80:83], s35 offen idxen "
        "offset:603 glc slc lds\n", 0xe08f725bU, 0x23143d12U, true, true, "" },
    { "buffer_load_short_d16 v61, v[18:19], s[80:83], s35 offen idxen "
        "offset:603 glc slc lds\n", 0xe093725bU, 0x23143d12U, true, true, "" },
    { "buffer_load_short_d16_hi v61, v[18:19], s[80:83], s35 offen idxen "
        "offset:603 glc slc lds\n", 0xe097725bU, 0x23143d12U, true, true, "" },
    { "buffer_load_format_d16_hi_x v61, v[18:19], s[80:83], s35 offen idxen "
        "offset:603 glc slc lds\n", 0xe09b725bU, 0x23143d12U, true, true, "" },
    { "buffer_store_format_d16_hi_x v61, v[18:19], s[80:83], s35 offen idxen "
        "offset:603 glc slc lds\n", 0xe09f725bU, 0x23143d12U, true, true, "" },
    /* MUBUF D16 FORMAT instrs */
    { "    buffer_load_format_d16_x v61, v18, s[80:83], s35 idxen offset:603",
        0xe020225bU, 0x23143d12U, true, true, "" },
    { "    buffer_load_format_d16_xy v61, v18, s[80:83], s35 idxen offset:603",
        0xe024225bU, 0x23143d12U, true, true, "" },
    { "    buffer_load_format_d16_xyz v[61:62], v18, s[80:83], s35 idxen offset:603",
        0xe028225bU, 0x23143d12U, true, true, "" },
    { "    buffer_load_format_d16_xyzw v[61:62], v18, s[80:83], s35 idxen offset:603",
        0xe02c225bU, 0x23143d12U, true, true, "" },
    { "    buffer_store_format_d16_x v61, v18, s[80:83], s35 idxen offset:603",
        0xe030225bU, 0x23143d12U, true, true, "" },
    { "    buffer_store_format_d16_xy v61, v18, s[80:83], s35 idxen offset:603",
        0xe034225bU, 0x23143d12U, true, true, "" },
    { "    buffer_store_format_d16_xyz v[61:62], v18, s[80:83], s35 idxen offset:603",
        0xe038225bU, 0x23143d12U, true, true, "" },
    { "    buffer_store_format_d16_xyzw v[61:62], v18, s[80:83], s35 idxen offset:603",
        0xe03c225bU, 0x23143d12U, true, true, "" },
    /* MTBUF D16 FORMAT instrs */
    { "    tbuffer_load_format_d16_x v61, v18, s[80:83], s35 idxen offset:2004 "
        "glc slc", 0xe80c67d4U, 0x23543d12U, true, true, "" },
    { "    tbuffer_load_format_d16_xy v61, v18, s[80:83], s35 idxen offset:2004 "
        "glc slc", 0xe80ce7d4U, 0x23543d12U, true, true, "" },
    { "    tbuffer_load_format_d16_xyz v[61:62], v18, s[80:83], s35 idxen offset:2004 "
        "glc slc", 0xe80d67d4U, 0x23543d12U, true, true, "" },
    { "    tbuffer_load_format_d16_xyzw v[61:62], v18, s[80:83], s35 idxen offset:2004 "
        "glc slc", 0xe80de7d4U, 0x23543d12U, true, true, "" },
    { "    tbuffer_store_format_d16_x v61, v18, s[80:83], s35 idxen offset:2004 "
        "glc slc", 0xe80e67d4U, 0x23543d12U, true, true, "" },
    { "    tbuffer_store_format_d16_xy v61, v18, s[80:83], s35 idxen offset:2004 "
        "glc slc", 0xe80ee7d4U, 0x23543d12U, true, true, "" },
    { "    tbuffer_store_format_d16_xyz v[61:62], v18, s[80:83], s35 idxen offset:2004 "
        "glc slc", 0xe80f67d4U, 0x23543d12U, true, true, "" },
    { "    tbuffer_store_format_d16_xyzw v[61:62], v18, s[80:83], s35 idxen offset:2004 "
        "glc slc", 0xe80fe7d4U, 0x23543d12U, true, true, "" },
    /* MIMG instructions */
    { "image_gather4h  v[157:160], v[121:124], s[84:91], s[0:3] dmask:11 "
        "unorm glc a16 da\n", 0xf108fb00U, 0x00159d79U, true, true, "" },
    { "image_gather4h  v[157:160], v[121:124], s[84:91], s[0:3] dmask:11 "
        "unorm glc da\n", 0xf1087b00U, 0x00159d79U, true, true, "" },
    { "image_gather4h_pck v[157:160], v[121:124], s[84:91], s[0:3] dmask:11 "
        "unorm glc a16 da\n", 0xf128fb00U, 0x00159d79U, true, true, "" },
    { "image_gather8h_pck v[157:160], v[121:124], s[84:91], s[0:3] dmask:11 "
        "unorm glc a16 da\n", 0xf12cfb00U, 0x00159d79U, true, true, "" },
    { "        image_load      v[157:160], v[121:124], s[84:91] dmask:15 "
        "glc slc lwe da\n", 0xf2026f00U, 0x00159d79U, true, true, "" },
    // DMASK D16
    { "image_load      v157, v[121:124], s[84:91] dmask:1 glc slc lwe da d16\n",
        0xf2026100U, 0x80159d79U, true, true, "" },
    { "image_load      v157, v[121:124], s[84:91] dmask:2 glc slc lwe da d16\n",
        0xf2026200U, 0x80159d79U, true, true, "" },
    { "image_load      v157, v[121:124], s[84:91] dmask:3 glc slc lwe da d16\n",
        0xf2026300U, 0x80159d79U, true, true, "" },
    { "image_load      v157, v[121:124], s[84:91] dmask:4 glc slc lwe da d16\n",
        0xf2026400U, 0x80159d79U, true, true, "" },
    { "image_load      v157, v[121:124], s[84:91] dmask:5 glc slc lwe da d16\n",
        0xf2026500U, 0x80159d79U, true, true, "" },
    { "image_load      v157, v[121:124], s[84:91] dmask:6 glc slc lwe da d16\n",
        0xf2026600U, 0x80159d79U, true, true, "" },
    { "image_load      v[157:158], v[121:124], s[84:91] dmask:7 glc slc lwe da d16\n",
        0xf2026700U, 0x80159d79U, true, true, "" },
    { "image_load      v157, v[121:124], s[84:91] dmask:8 glc slc lwe da d16\n",
        0xf2026800U, 0x80159d79U, true, true, "" },
    { "image_load      v157, v[121:124], s[84:91] dmask:9 glc slc lwe da d16\n",
        0xf2026900U, 0x80159d79U, true, true, "" },
    { "image_load      v157, v[121:124], s[84:91] dmask:10 glc slc lwe da d16\n",
        0xf2026a00U, 0x80159d79U, true, true, "" },
    { "image_load      v[157:158], v[121:124], s[84:91] dmask:11 glc slc lwe da d16\n",
        0xf2026b00U, 0x80159d79U, true, true, "" },
    { "image_load      v157, v121, s[84:91] dmask:12 glc slc lwe da d16\n",
        0xf2026c00U, 0x80159d79U, true, true, "" },
    { "image_load      v[157:158], v[121:124], s[84:91] dmask:13 glc slc lwe da d16\n",
        0xf2026d00U, 0x80159d79U, true, true, "" },
    { "image_load      v[157:158], v[121:124], s[84:91] dmask:14 glc slc lwe da d16\n",
        0xf2026e00U, 0x80159d79U, true, true, "" },
    { "image_load      v[157:158], v[121:124], s[84:91] dmask:15 glc slc lwe da d16\n",
        0xf2026f00U, 0x80159d79U, true, true, "" },
    { "image_load      v[157:159], v[121:124], s[84:91] dmask:15 glc slc lwe da d16 tfe\n",
        0xf2036f00U, 0x80159d79U, true, true, "" },
    /* FLAT encoding */
    { "flat_load_ubyte v47, v[187:188] nv\n", 0xdc400000U, 0x2f8000bbU, true, true, "" },
    { "flat_load_ubyte v47, v[187:188]\n", 0xdc400000U, 0x2f0000bbU, true, true, "" },
    { "flat_load_ubyte v47, v[187:188] inst_offset:529\n",
        0xdc400211U, 0x2f0000bbU, true, true, "" },
    { "flat_load_ubyte v47, v[187:188] offset:529\n",
        0xdc400211U, 0x2f0000bbU, true, true, "" },
    { "flat_load_ubyte v47, v[187:188] inst_offset:zzz\nzzz=529\n",
        0xdc400211U, 0x2f0000bbU, true, true, "" },
    /* FLAT instructions */
    { "flat_store_byte_d16_hi " "v[187:188], v65 glc slc nv\n",
        0xdc670000U, 0x008041bbU, true, true, "" },
    { "flat_store_short_d16_hi " "v[187:188], v65 glc slc nv\n",
        0xdc6f0000U, 0x008041bbU, true, true, "" },
    { "flat_load_ubyte_d16 " "v47, v[187:188] glc slc nv\n",
        0xdc830000U, 0x2f8000bbU, true, true, "" },
    { "flat_load_ubyte_d16_hi " "v47, v[187:188] glc slc nv\n",
        0xdc870000U, 0x2f8000bbU, true, true, "" },
    { "flat_load_sbyte_d16 " "v47, v[187:188] glc slc nv\n",
        0xdc8b0000U, 0x2f8000bbU, true, true, "" },
    { "flat_load_sbyte_d16_hi " "v47, v[187:188] glc slc nv\n",
        0xdc8f0000U, 0x2f8000bbU, true, true, "" },
    { "flat_load_short_d16 " "v47, v[187:188] glc slc nv\n",
        0xdc930000U, 0x2f8000bbU, true, true, "" },
    { "flat_load_short_d16_hi " "v47, v[187:188] glc slc nv\n",
        0xdc970000U, 0x2f8000bbU, true, true, "" },
    /* FLAT SCRATCH encoding */
    { "scratch_load_ubyte v47, off, s49 glc slc\n",
        0xdc434000U, 0x2f310000U, true, true, "" },
    { "scratch_load_ubyte v47, v187, off glc slc\n",
        0xdc434000U, 0x2f7f00bbU, true, true, "" },
    { "scratch_load_ubyte v47, v187, off glc slc nv\n",
        0xdc434000U, 0x2fff00bbU, true, true, "" },
    { "scratch_load_ubyte v47, v187, off inst_offset:1043 glc slc\n",
        0xdc434413U, 0x2f7f00bbU, true, true, "" },
    { "scratch_load_ubyte v47, v187, off inst_offset:zz glc slc\nzz=1043\n",
        0xdc434413U, 0x2f7f00bbU, true, true, "" },
    { "scratch_load_ubyte v47, v187, off inst_offset:-3053 glc slc\n",
        0xdc435413U, 0x2f7f00bbU, true, true, "" },
    { "scratch_load_ubyte v47, v187, off inst_offset:zz glc slc\nzz=-3053\n",
        0xdc435413U, 0x2f7f00bbU, true, true, "" },
    { "scratch_load_ubyte v47, v187, off inst_offset:-4096 glc slc\n",
        0xdc435000U, 0x2f7f00bbU, true, true, "" },
    { "scratch_load_ubyte v47, v187, off inst_offset:zzx glc slc\nzzx=-4096\n",
        0xdc435000U, 0x2f7f00bbU, true, true, "" },
    /* FLAT SCRATCH instructions */
    { "scratch_load_sbyte v47, off, s49 glc slc lds\n",
        0xdc476000U, 0x2f310000U, true, true, "" },
    { "scratch_load_sbyte v47, off, s49 glc slc\n",
        0xdc474000U, 0x2f310000U, true, true, "" },
    { "scratch_load_ushort v47, off, s49 glc slc\n",
        0xdc4b4000U, 0x2f310000U, true, true, "" },
    { "scratch_load_sshort v47, off, s49 glc slc\n",
        0xdc4f4000U, 0x2f310000U, true, true, "" },
    { "scratch_load_dword v47, off, s49 glc slc\n",
        0xdc534000U, 0x2f310000U, true, true, "" },
    { "scratch_load_dwordx2 v[47:48], off, s49 glc slc\n",
        0xdc574000U, 0x2f310000U, true, true, "" },
    { "scratch_load_dwordx3 v[47:49], off, s49 glc slc\n",
        0xdc5b4000U, 0x2f310000U, true, true, "" },
    { "scratch_load_dwordx4 v[47:50], off, s49 glc slc\n",
        0xdc5f4000U, 0x2f310000U, true, true, "" },
    { "scratch_store_byte off, v65, s49 glc slc\n",
        0xdc634000U, 0x00314100U, true, true, "" },
    { "scratch_store_byte_d16_hi off, v65, s49 glc slc\n",
        0xdc674000U, 0x00314100U, true, true, "" },
    { "scratch_store_short off, v65, s49 glc slc\n",
        0xdc6b4000U, 0x00314100U, true, true, "" },
    { "scratch_store_short_d16_hi off, v65, s49 glc slc\n",
        0xdc6f4000U, 0x00314100U, true, true, "" },
    { "scratch_store_dword off, v65, s49 glc slc\n",
        0xdc734000U, 0x00314100U, true, true, "" },
    { "scratch_store_dwordx2 off, v[65:66], s49 glc slc\n",
        0xdc774000U, 0x00314100U, true, true, "" },
    { "scratch_store_dwordx3 off, v[65:67], s49 glc slc\n",
        0xdc7b4000U, 0x00314100U, true, true, "" },
    { "scratch_store_dwordx4 off, v[65:68], s49 glc slc\n",
        0xdc7f4000U, 0x00314100U, true, true, "" },
    { "scratch_load_ubyte_d16 v47, off, s49 glc slc\n",
        0xdc834000U, 0x2f310000U, true, true, "" },
    { "scratch_load_ubyte_d16_hi v47, off, s49 glc slc\n",
        0xdc874000U, 0x2f310000U, true, true, "" },
    { "scratch_load_sbyte_d16 v47, off, s49 glc slc\n",
        0xdc8b4000U, 0x2f310000U, true, true, "" },
    { "scratch_load_sbyte_d16_hi v47, off, s49 glc slc\n",
        0xdc8f4000U, 0x2f310000U, true, true, "" },
    { "scratch_load_short_d16 v47, off, s49 glc slc\n",
        0xdc934000U, 0x2f310000U, true, true, "" },
    { "scratch_load_short_d16_hi v47, off, s49 glc slc\n",
        0xdc974000U, 0x2f310000U, true, true, "" },
    /* FLAT GLOBAL encoding */
    { "global_load_ubyte v47, v187, s[50:51] glc slc lds\n",
        0xdc43a000U, 0x2f3200bbU, true, true, "" },
    { "global_load_ubyte v47, v187, s[50:51] glc slc\n",
        0xdc438000U, 0x2f3200bbU, true, true, "" },
    { "global_load_ubyte v47, v[187:188], off glc slc\n",
        0xdc438000U, 0x2f7f00bbU, true, true, "" },
    { "global_load_ubyte v47, v[187:188], off glc slc\n",
        0xdc438000U, 0x2f7f00bbU, true, true, "" },
    { "global_load_ubyte v47, v187, s[50:51] inst_offset:1043 glc slc\n",
        0xdc438413U, 0x2f3200bbU, true, true, "" },
    { "global_load_ubyte v47, v187, s[50:51] inst_offset:zz glc slc\nzz=1044\n",
        0xdc438414U, 0x2f3200bbU, true, true, "" },
    { "global_load_ubyte v47, v187, s[50:51] inst_offset:-3053 glc slc\n",
        0xdc439413U, 0x2f3200bbU, true, true, "" },
    { "global_load_ubyte v47, v187, s[50:51] inst_offset:zza glc slc\nzza=-3057\n",
        0xdc43940fU, 0x2f3200bbU, true, true, "" },
    { "global_load_dword v3, v[5:6], off\n",
        0xdc508000U, 0x037f0005U, true, true, "" },
    /* FLAT GLOBAL instructions */
    { "global_load_sbyte v47, v187, s[50:51] glc slc\n",
        0xdc478000U, 0x2f3200bbU, true, true, "" },
    { "global_load_ushort v47, v187, s[50:51] glc slc\n",
        0xdc4b8000U, 0x2f3200bbU, true, true, "" },
    { "global_load_sshort v47, v187, s[50:51] glc slc\n",
        0xdc4f8000U, 0x2f3200bbU, true, true, "" },
    { "global_load_dword v47, v187, s[50:51] glc slc\n",
        0xdc538000U, 0x2f3200bbU, true, true, "" },
    { "global_load_dwordx2 v[47:48], v187, s[50:51] glc slc\n",
        0xdc578000U, 0x2f3200bbU, true, true, "" },
    { "global_load_dwordx3 v[47:49], v187, s[50:51] glc slc\n",
        0xdc5b8000U, 0x2f3200bbU, true, true, "" },
    { "global_load_dwordx4 v[47:50], v187, s[50:51] glc slc\n",
        0xdc5f8000U, 0x2f3200bbU, true, true, "" },
    { "global_store_byte v187, v65, s[50:51] glc slc\n",
        0xdc638000U, 0x003241bbU, true, true, "" },
    { "global_store_byte_d16_hi v187, v65, s[50:51] glc slc\n",
        0xdc678000U, 0x003241bbU, true, true, "" },
    { "global_store_short v187, v65, s[50:51] glc slc\n",
        0xdc6b8000U, 0x003241bbU, true, true, "" },
    { "global_store_short_d16_hi v187, v65, s[50:51] glc slc\n",
        0xdc6f8000U, 0x003241bbU, true, true, "" },
    { "global_store_dword v187, v65, s[50:51] glc slc\n",
        0xdc738000U, 0x003241bbU, true, true, "" },
    { "global_store_dwordx2 v187, v[65:66], s[50:51] glc slc\n",
        0xdc778000U, 0x003241bbU, true, true, "" },
    { "global_store_dwordx3 v187, v[65:67], s[50:51] glc slc\n",
        0xdc7b8000U, 0x003241bbU, true, true, "" },
    { "global_store_dwordx4 v187, v[65:68], s[50:51] glc slc\n",
        0xdc7f8000U, 0x003241bbU, true, true, "" },
    { "global_load_ubyte_d16 v47, v187, s[50:51] glc slc\n",
        0xdc838000U, 0x2f3200bbU, true, true, "" },
    { "global_load_ubyte_d16_hi v47, v187, s[50:51] glc slc\n",
        0xdc878000U, 0x2f3200bbU, true, true, "" },
    { "global_load_sbyte_d16 v47, v187, s[50:51] glc slc\n",
        0xdc8b8000U, 0x2f3200bbU, true, true, "" },
    { "global_load_sbyte_d16_hi v47, v187, s[50:51] glc slc\n",
        0xdc8f8000U, 0x2f3200bbU, true, true, "" },
    { "global_load_short_d16 v47, v187, s[50:51] glc slc\n",
        0xdc938000U, 0x2f3200bbU, true, true, "" },
    { "global_load_short_d16_hi v47, v187, s[50:51] glc slc\n",
        0xdc978000U, 0x2f3200bbU, true, true, "" },
    { "global_atomic_swap v47, v187, v65, s[50:51] glc slc\n",
        0xdd038000U, 0x2f3241bbU, true, true, "" },
    { "global_atomic_cmpswap v47, v187, v[65:66], s[50:51] glc slc\n",
        0xdd078000U, 0x2f3241bbU, true, true, "" },
    { "global_atomic_add v47, v187, v65, s[50:51] glc slc\n",
        0xdd0b8000U, 0x2f3241bbU, true, true, "" },
    { "global_atomic_add v187, v65, s[50:51] slc\n",
        0xdd0a8000U, 0x003241bbU, true, true, "" }, // no dst
    { "global_atomic_sub v47, v187, v65, s[50:51] glc slc\n",
        0xdd0f8000U, 0x2f3241bbU, true, true, "" },
    { "global_atomic_smin v47, v187, v65, s[50:51] glc slc\n",
        0xdd138000U, 0x2f3241bbU, true, true, "" },
    { "global_atomic_umin v47, v187, v65, s[50:51] glc slc\n",
        0xdd178000U, 0x2f3241bbU, true, true, "" },
    { "global_atomic_smax v47, v187, v65, s[50:51] glc slc\n",
        0xdd1b8000U, 0x2f3241bbU, true, true, "" },
    { "global_atomic_umax v47, v187, v65, s[50:51] glc slc\n",
        0xdd1f8000U, 0x2f3241bbU, true, true, "" },
    { "global_atomic_and v47, v187, v65, s[50:51] glc slc\n",
        0xdd238000, 0x2f3241bbU, true, true, "" },
    { "global_atomic_or v47, v187, v65, s[50:51] glc slc\n",
        0xdd278000, 0x2f3241bbU, true, true, "" },
    { "global_atomic_xor v47, v187, v65, s[50:51] glc slc\n",
        0xdd2b8000, 0x2f3241bbU, true, true, "" },
    { "global_atomic_inc v47, v187, v65, s[50:51] glc slc\n",
        0xdd2f8000, 0x2f3241bbU, true, true, "" },
    { "global_atomic_dec v47, v187, v65, s[50:51] glc slc\n",
        0xdd338000, 0x2f3241bbU, true, true, "" },
    { "global_atomic_swap_x2 v[47:48], v187, v[65:66], s[50:51] glc slc\n",
        0xdd838000U, 0x2f3241bbU, true, true, "" },
    { "global_atomic_cmpswap_x2 v[47:48], v187, v[65:68], s[50:51] glc slc\n",
        0xdd878000U, 0x2f3241bbU, true, true, "" },
    { "global_atomic_add_x2 v[47:48], v187, v[65:66], s[50:51] glc slc\n",
        0xdd8b8000U, 0x2f3241bbU, true, true, "" },
    { "global_atomic_sub_x2 v[47:48], v187, v[65:66], s[50:51] glc slc\n",
        0xdd8f8000U, 0x2f3241bbU, true, true, "" },
    { "global_atomic_smin_x2 v[47:48], v187, v[65:66], s[50:51] glc slc\n",
        0xdd938000U, 0x2f3241bbU, true, true, "" },
    { "global_atomic_umin_x2 v[47:48], v187, v[65:66], s[50:51] glc slc\n",
        0xdd978000U, 0x2f3241bbU, true, true, "" },
    { "global_atomic_smax_x2 v[47:48], v187, v[65:66], s[50:51] glc slc\n",
        0xdd9b8000U, 0x2f3241bbU, true, true, "" },
    { "global_atomic_umax_x2 v[47:48], v187, v[65:66], s[50:51] glc slc\n",
        0xdd9f8000U, 0x2f3241bbU, true, true, "" },
    { "global_atomic_and_x2 v[47:48], v187, v[65:66], s[50:51] glc slc\n",
        0xdda38000, 0x2f3241bbU, true, true, "" },
    { "global_atomic_or_x2 v[47:48], v187, v[65:66], s[50:51] glc slc\n",
        0xdda78000, 0x2f3241bbU, true, true, "" },
    { "global_atomic_xor_x2 v[47:48], v187, v[65:66], s[50:51] glc slc\n",
        0xddab8000, 0x2f3241bbU, true, true, "" },
    { "global_atomic_inc_x2 v[47:48], v187, v[65:66], s[50:51] glc slc\n",
        0xddaf8000, 0x2f3241bbU, true, true, "" },
    { "global_atomic_dec_x2 v[47:48], v187, v[65:66], s[50:51] glc slc\n",
        0xddb38000, 0x2f3241bbU, true, true, "" },
    /* GLOBAL error wrong VADDR */
    { "global_load_ubyte v47, v[187:188], s[50:51] glc slc\n",
        0, 0, false, false, "test.s:1:24: Error: Required 1 vector register\n" },
    // VOP3 CMP
    { "    v_cmp_f_f16 s[46:47], v78, v201", 0xd020002eU, 0x3934eU, true, true, "" },
    { "    v_cmp_lt_f16 s[46:47], v78, v201", 0xd021002eU, 0x3934eU, true, true, "" },
    { nullptr, 0, 0, false, false, 0 }
};

const GCNAsmOpcodeCase encGCN141OpcodeCases[] =
{
    /* GCN 1.2 flat scratch */
    { "    s_add_u32  flat_scratch_lo, s4, s61", 0x80663d04U, 0, false, true, "" },
    { "    s_add_u32  flat_scratch_hi, s4, s61", 0x80673d04U, 0, false, true, "" },
    //
    { "v_mad_mix_f32   v55, v79, v166, v229\n", 0xd3a04037U, 0x1f974d4fU, true, true, "" },
    { "v_mad_mixlo_f16 v55, v79, v166, v229\n", 0xd3a14037U, 0x1f974d4fU, true, true, "" },
    { "v_mad_mixhi_f16 v55, v79, v166, v229\n", 0xd3a24037U, 0x1f974d4fU, true, true, "" },
    { "v_fma_mix_f32   v55, v79, v166, v229\n", 0xd3a04037U, 0x1f974d4fU, true, true, "" },
    { "v_fma_mixlo_f16 v55, v79, v166, v229\n", 0xd3a14037U, 0x1f974d4fU, true, true, "" },
    { "v_fma_mixhi_f16 v55, v79, v166, v229\n", 0xd3a24037U, 0x1f974d4fU, true, true, "" },
    { "v_dot2_f32_f16  v55, v79, v166, v229\n", 0xd3a34037U, 0x1f974d4fU, true, true, "" },
    { "v_dot2_i32_i16  v55, v79, v166, v229\n", 0xd3a64037U, 0x1f974d4fU, true, true, "" },
    { "v_dot2_u32_u16  v55, v79, v166, v229\n", 0xd3a74037U, 0x1f974d4fU, true, true, "" },
    { "v_dot4_i32_i8   v55, v79, v166, v229\n", 0xd3a84037U, 0x1f974d4fU, true, true, "" },
    { "v_dot4_u32_u8   v55, v79, v166, v229\n", 0xd3a94037U, 0x1f974d4fU, true, true, "" },
    { "v_dot8_i32_i4   v55, v79, v166, v229\n", 0xd3aa4037U, 0x1f974d4fU, true, true, "" },
    { "v_dot8_u32_u4   v55, v79, v166, v229\n", 0xd3ab4037U, 0x1f974d4fU, true, true, "" },
    { "v_fmac_f32      v154, v21, v107\n", 0x7734d715U, 0, false, true, ""  },
    { "v_fmac_f32      v55, s27, v90 vop3\n", 0xd13b0037U, 0x0002b41bU, true, true, "" },
    { "v_xnor_b32      v154, v21, v107\n", 0x7b34d715U, 0, false, true, "" },
    { "v_xnor_b32      v55, s27, v90 vop3\n", 0xd13d0037U, 0x0002b41bU, true, true, "" },
    // VOP3P from GCN 1.4
    { "v_pk_mad_i16    v55, v79, v166, v229 op_sel_hi:[0,0,0]\n",
        0xd3800037U, 0x07974d4fU, true, true, "" },
    { "v_pk_mad_i16    v55, v79, v166, v229\n",
        0xd3804037U, 0x1f974d4fU, true, true, "" },
    { "v_pk_mad_i16    v55, v79, v166, v229 op_sel_hi:[1,0,0]\n",
        0xd3800037U, 0x0f974d4fU, true, true, "" },
    { "v_addc_co_u32   v154, vcc, v21, v107, vcc\n", 0x3934d715U, 0, false, true, "" },
    { "v_subb_co_u32   v154, vcc, v21, v107, vcc\n", 0x3b34d715U, 0, false, true, "" },
    { "v_mov_prsv_b32  v55, v27 vop3\n", 0xd1760037U, 0x0000011bU, true, true, "" },
    { "v_screen_partition_4se_b32 v55, v27 vop3\n",
        0xd1770037U, 0x0000011bU, true, true, "" },
    // VOP3 CMP
    { "    v_cmp_f_f16 s[46:47], v78, v201", 0xd020002eU, 0x3934eU, true, true, "" },
    { "    v_cmp_lt_f16 s[46:47], v78, v201", 0xd021002eU, 0x3934eU, true, true, "" },
    { nullptr, 0, 0, false, false, 0 }
};
